#!/usr/bin/env python
#-*- coding:utf-8 -*-

"""
	PROJECT pyevocomm -

	APP		socket client tts

	MODULE	Text to speech client

	SITE DESCRIPTION http://code.google.com/p/pyevocomm/ 

	@copyright: 2012 by archetipo <alessio.gerace@gmail.com>
	@license: New BSD License, see COPYING for details.
"""

from socket import *
import threading
import json

Host_server = "19.61.1.4" # L'host del server in questo caso corrisponde al localhost poiché stiamo lavorado in locale, ma cambierà a seconda della posizione del server in ascolto
Port_server = 4000

class ClientThread ( threading.Thread ):
	def __init__ ( self, data):
		self.data = data
		self.dat={'comm':'','dat':''}
		threading.Thread.__init__ ( self )
	def run ( self ):
		client = socket(AF_INET, SOCK_STREAM)
		client.connect((Host_server, Port_server)) 
		self.dat['comm']='play'
		self.dat['dat']=self.data
		j=json.dumps(self.dat)
		client.send(j) 
		var=''
		
def parla(dato):
	ClientThread (dato).start()
	
#Test
#Parla("Test")



